<extend name="Base/agent"/>
<block name="content">
	<!--主体内容-->
	<div class="admin-main">
		<p class="current-title">资金明细</p>
		<p class="current-park"><i class="icon icon-index"></i><a href="{:U('AgentIndex/index')}" class="current-index">坐市商管理</a> 〉〉 资金明细</p>
		<div class="current-condition">
			<select class="yorn-broker" id = "option">
				<option value="0" <if condition="$option eq 0">selected="selected"</if>>订单类型</option>
				<option value="1" <if condition="$option eq 1">selected="selected"</if>>螺纹钢类型</option>
				<option value="2" <if condition="$option eq 2">selected="selected"</if>>恒指类型</option>
			</select>
			<select class="yorn-broker" id="state">
				<option value="0" <if condition="$status eq 0">selected="selected"</if>>操作类型</option>
				<if condition = "$_GET['type'] eq 1">
					<option value="1" <if condition="$status eq 1">selected="selected"</if>>下单</option>
					<option value="4" <if condition="$status eq 4">selected="selected"</if>>佣金</option>
					<option value="5" <if condition="$status eq 5">selected="selected"</if>>亏损</option>
				<elseif condition = "$_GET['type'] eq 2"/>
					<option value="2" <if condition="$status eq 2">selected="selected"</if>>充值</option>
					<option value="3" <if condition="$status eq 3">selected="selected"</if>>提现</option>
				<elseif condition = "$_GET['type'] eq 3"/>
					<option value="6" <if condition="$status eq 6">selected="selected"</if>>充值手续费</option>
					<option value="7" <if condition="$status eq 7">selected="selected"</if>>提现手续费</option>
				</if>
			</select>
			<input type="text" class="current-username" id="username" placeholder="用户昵称" value="{$_GET['username']}"/><br/>
			<input type="text" id="option_time" class="current-stardate" placeholder="操作时间" value="{$option_time}"/>
			<input type="text" id="create_time" class="current-stardate" placeholder="创建时间" value="{$create_time}"/>
			<input type="button" id="search" value="搜索" class="current-serach"/>
			<input type="button" id="downexcle" value="导出EXECL" class="current-serach"/>
		</div>
		<!--数据表格-->
		<div class="main-table-data">
			<p class="table-title">资金明细</p>
			<table class="current-table" >
				<tr>
					<th>用户昵称</th>
					<th>操作资金</th>
					<th>操作类型</th>
					<if condition = "$_GET['type'] eq 1">
					<th>订单号</th>
					</if>
					<th>订单类型</th>
					<th>操作时间</th>
					<th>创建时间</th>
				</tr>
			<foreach name="list" item="vo">
				<tr class="table-nobg">
					<td>{$vo.user_name}</td>
					<td>{$vo.money} 元</td>
					<td>
						<foreach name = "money_log_type" item = "v" key = "k">
							<if condition = "$vo['money_type'] eq $v">
							{$k}
							</if>
						</foreach>
					</td>
					<if condition = "$_GET['type'] eq 1">
					<td>{$vo.option}</td>
					</if>
					<td>
					<if condition="$vo['order_id_type'] eq 1">
					螺纹钢类型
					<elseif  condition="$vo['order_id_type'] eq 2"/>
					恒指类型
					<elseif  condition="$vo['order_id_type'] eq 3"/>
					欧元类型
					</if>
					</td>
					<td>{$vo.option_time|date='Y-m-d H:i:s',###}</td>
					<td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
				</tr>
			</foreach>
			</table>
			<div class="current-page">
						{$_page}
			</div>
		</div>
		
	</div>
	<script type="text/javascript">
		$(function(){
			function myfunc(){
				var string="";
				var username=$("#username").val();
				if(username){
					string="/username/"+username;
				}
				var state=$("#state").val();
				if(state!==''){
					string+="/state/"+state;
				}
				var option_time=$("#option_time").val();
				if(option_time!=""){
					string+="/option_time/"+option_time;
				}
				var create_time=$("#create_time").val();
				if(create_time!=""){
					string+="/create_time/"+create_time;
				}
				var option = $("#option").val();
				if(option!=""){
					string+="/option/"+option;
				}
				return string;
			}
			$("#downexcle").click(function(){
				var string=myfunc();
				var url ="{:U('AgentOptionWriter/dow?type='.$_GET['type'])}";
				url = url.substr(0,url.lastIndexOf('.'))+string;
				window.location.href=url;
			})

			$("#search").click(function(){
				var string=myfunc();
				var url ="{:U('AgentOptionWriter/index?type='.$_GET['type'])}";
				url = url.substr(0,url.lastIndexOf('.'))+string;
				window.location.href=url;
			})
		})
	</script>
</block>
